#动态创建类
def hello(self):
    print("hello,"+self.__class__.__name__)
Person = type("Person",(), {"name":"人","hello":hello})
Student = type("Student",(Person,),{"school":"陕西大学","say":lambda self:print(f"I'm {self.name}")})


s = Student()
#s = Student(name="rose",school="清华大学")  #不能这样传参
s.name = "罗斯"
print(s.name)
s.say()
s.hello()
pass

#########################################################################################
class MyMeta(type):
    def __new__(cls, *args, **kwargs):
        return super().__new__(cls,*args,**kwargs)

class User(metaclass=MyMeta):
    def __init__(self,name):
        self.name = name

    def __str__(self):
        return f"User name={self.name}"
u = User("jack")
print(u)
pass